package com.htz.java250805_library.service;

import com.htz.java250805_library.entity.UserInfo;
import com.htz.java250805_library.mapper.UserMapper;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
@Slf4j
@Service
public class UserService {
    @Autowired
    private UserMapper userMapper;
    //验证密码是否正确
    public Boolean checkPassword(String name, String password) {
        //1.根据名称获取用户信息
        UserInfo userInfo = userMapper.selectUserByName(name);
        //2.验证密码是否正确
        if (userInfo == null){
            log.warn("用户信息不存在，name:"+name);
            return false;
        }
        return password.equals(userInfo.getPassword());
    }
}































